package com.mtons.mblog.web.controller.site;

import com.mtons.mblog.modules.service.ArchiveService;
import com.mtons.mblog.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 文章归档.
 * @author yuzhong
 * @date 2019/2/26 18:41
 */
@Controller
public class ArchiveController extends BaseController {
    @Autowired
    private ArchiveService archiveService;

    /**
     * 查询所有文章列表做归档
     * @return
     */
    @GetMapping("/archive")
    public String view(ModelMap model) {
        model.put("archives", archiveService.findPostGroupByYearAndMonth());
        return view(Views.ARCHIVE);
    }


}
